<template>
  <div id="app">
    <!-- <Confirm :visible.sync="visible">
      <template v-slot:default="{person}">
        {{person}}
        <ul>
          <li v-for="(value, key, index) in person" :key="key">{{key}}-{{key}}-{{index}}</li>
        </ul>
      </template>
     
      <template v-slot:footer>
        <button>cancel</button>
      </template>
    </Confirm> -->
    <!-- <div>
      <button @click="visible=false">关闭</button> <button @click="visible=true">打开</button>
    </div> -->
    <Header></Header>
    <router-view></router-view>
    <Footer v-if="!['login', 'register'].includes($route.name)"></Footer>
    <keep-alive in></keep-alive>
  </div>
</template>

<script>
import Header from '@/components/Header'
import Footer from '@/components/Footer'

export default {
  name: 'App',
  components: {
    Header,
    Footer,
  },
  data() {
    return {
      visible: false
    }
  },
  async mounted() {
    // dispatch 方法返回的是一个 Promise 对象，可以等待异步结束后再执行后面的代码
    // 防止多次请求，放入 App 组件中
    await this.$store.dispatch('home/getCategoryList')
  },
  
}
</script>

<style lang="less">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  // text-align: center;
  color: #2c3e50;
  // margin-top: 60px;
  // scroll-behavior: smooth;
} 

</style>
